<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>arrayToHTMLList</title>
</head>

<body>
    <ul id="list"></ul>
    <script>
        const arrayToHTMLList = (arr, listId) => {
            let list = document.querySelector(`#${listId}`);
            list.innerHTML = arr.map(item => `<li>${item}</li>`).join('');
            return list;
        }
        arrayToHTMLList(['item 1', 'item 2', 'item 3'], 'list');
    </script>
</body>

</html>